/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Dao;
import Util.MySqlDataAccessHelper;
import Pojo.TheLoai;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author USER
 */
public class TheLoaiDAO {
   
    
    //lấy danh sách thể loại
    public static List<TheLoai> layTheLoai(String mySQL){
        List<TheLoai> tls = new ArrayList<TheLoai>();
        
        try{        
            MySqlDataAccessHelper helper = new MySqlDataAccessHelper();
            helper.open();
            ResultSet rs = helper.executeQuery(mySQL);
            while(rs.next()){
                TheLoai tl = new TheLoai();
                tl.setMaTheLoai(rs.getInt("ma_the_loai"));
                tl.setTenTheLoai(rs.getString("ten_the_loai"));             
                tls.add(tl);
            }
            
            helper.close();
        }catch(Exception e){
            
        }
        
        return tls;
    }
}
